import request from '@/utils/request'
import {encodeParams} from '@/utils'
import { Message } from 'element-ui'
//列表
export function getList(data) {
  return request({
    url: '/api/frontUser?${encodeParams(data)}',
    method: 'POST',
    data
  })
}


// 根据ID获取用户基本信息
export function getBaseInfoById(id) {
  if(id == undefined) return Message.error('参数丢失')
  return request({
    url: `/api/frontUser/getBaseInfoById/${id}`,
    method: 'GET'
  })
}

//根据用户ID获取用户育儿顾问
export function getSalerInfoById(id) {
  return request({
    url: `/api/frontUser/getSalerInfoById/${id}`,
    method: 'GET'
  })
}

// 根据用户ID获取用户课程订单统计信息
export function getCourseOrderCountByUserId(id) {
  return request({
    url: `/api/frontUser/getCourseOrderCountByUserId/${id}`,
    method: 'GET'
  })
}

//用户积分合计
export function getUserBonusTotal(id) {
  return request({
    url: `/api/frontUser/getUserBonusTotal/${id}`,
    method: 'GET'
  })
}

//根据用户ID获取用户商品订单信息
export function getGoodsOrderById(data) {
  return request({
    url: `/api/frontUser/getGoodsOrder`,
    method: 'POST',
    data
  })
}

//添加备注
export function addFollow(data) {
  return request({
    url: '/api/frontUser/follow',
    method: 'POST',
    data
  })
}

//获取订单tab数量
export function getTabCount() {
  return request({
    url: `/api/frontUser/count`,
    method: 'GET'
  })
}

//获取订单可修改月龄范围信息
export function getUpdatePrepareInfo(userId) {
  return request({
    url: `/api/courseOrder/getUpdatePrepareInfo/${userId}`,
    method: 'GET'
  })
}

//更新订单月龄
export function updateOrderMonthAge(data) {
  return request({
    url: `/api/courseOrder/updateOrderMonthAge`,
    method: 'POST',
    data
  })
}

//课程订单生日修改记录
export function getOrderBirthUpdateRecordByUserId(id) {
  return request({
    url: `/api/courseOrder/getOrderBirthUpdateRecordByUserId/${id}`,
    method: 'GET'
  })
}

//用户积分流水分页查询
export function userBonusFlowPage(data) {
  return request({
    url: `/api/frontUser/userBonusFlowPage`,
    method: 'POST',
    data
  })
}

//根据用户ID获取用户邀请记录
export function userInviteRecordPage(data) {
  return request({
    url: `/api/frontUser/userInviteRecordPage`,
    method: 'POST',
    data
  })
}

